package com.zzyl.controller;
import com.zzyl.mapper.RoomTypeMapper;
import com.zzyl.pojo.PageResult;
import com.zzyl.pojo.Result;
import com.zzyl.pojo.RoomType;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cache.annotation.CacheEvict;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
public class RoomTypeController {
    @Autowired
    private RoomTypeMapper roomTypeMapper;


    @GetMapping("/customer/roomTypes")
    @Cacheable(value = "roomCache",key = "#status")
    @CacheEvict(value = "roomCache",allEntries = true)
    public Result<PageResult<RoomType>> findAll(Integer status) {
       List<RoomType> rts = roomTypeMapper.selectAll(status);
        return Result.success(rts);
    }
}

